package com.yonyou.cyxdms.sysAuth.service.mapper.notification;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.dao.base.SuperMapper;
import com.yonyou.cyxdms.sysAuth.service.dto.AscInfoDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.notification.NotificationDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.notification.NotificationDealerRoleListDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.notification.NotificationInfoDTO;
import com.yonyou.cyxdms.sysAuth.service.entity.notification.NotificationPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 通知通告信息表 Mapper 接口
 * </p>
 *
 * @author adu
 * @since 2019-10-14
 */
@Repository
public interface NotificationMapper extends SuperMapper<NotificationPO> {


    public Integer intertNocice(NotificationPO notificationpo);

    public List<Map<String, Object>> getNoticeInfo(Page page, @Param("params") Map<String, Object> queryCondition);

    public List<Map<String, Object>> getNoticeInfos(@Param("page") Page page, @Param("params") Map<String, Object> queryCondition);

    public List<Map<String, Object>> getNoticeJxsInfos(Page page, @Param("params") Map<String, Object> queryCondition);
    public List<Map<String, Object>> getNoticeDealerInfos(@Param("page") Page page, @Param("params") Map<String, Object> params);

    /**
     * 已读列表
     *
     * @param page
     * @param queryCondition
     * @return
     */
    public List<Map<String, Object>> getNoticeInfoIsRead(Page page, @Param("params") Map<String, Object> queryCondition);

    /**
     * 已读数
     *
     * @param notificationId
     * @return
     */
    public Integer getAlreadyIsRead(@Param("params") Integer notificationId);

    /**
     * 未读数
     *
     * @param notificationId
     * @return
     */
    public Integer getAlreadyNoRead(@Param("params") Integer notificationId);

    /**
     * 通告notificationId 来获取通知通告主数据
     *
     * @param notificationId
     * @return
     */
    NotificationInfoDTO getNotificationMain(long notificationId);


    /**
     * 通过ID修改通知通告状态
     *
     * @param notificationId
     * @param status
     * @return
     */
    void withdrawNotificaion(Long notificationId, Integer isDelete, Integer status, Long updateBy);

    Integer getByStatusId(Integer status, Long id, String appId);

    public List<Map<String, Object>> getIsReadList(@Param("id") Integer id, @Param("companyId") Long companyId);

    public List<Map<String, Object>> getCcNoReadList(@Param("page") Page<Map<String, Object>> page, @Param("id") Integer id, @Param("companyId") Long companyId);

    public List<Map<String, Object>> getJxsNoReadList(@Param("dataType") Integer dataType, @Param("id") Integer id, @Param("appId") String appId);


    public List<Map<String, Object>> getNoReadList(@Param("id") Integer id, @Param("companyId") Long companyId);

    //经销商角色
    List<Object> getdealerRoleUser(@Param("codeId") List<Long> codeId, @Param("ownerCode") List<String> ownerCode, @Param("appId") String appId);

    //经销商
    List<Object> getdealerInfo(@Param("ownerCode") List<String> ownerCode, @Param("appId") String appId);

    //车厂角色（用户）
    List<Object> getRoleUserInfo(@Param("roleId") List<Long> roleId, @Param("appId") String appId);

    List<Map<String, Object>> getNoticeInfoNoRead(@Param("params") Map<String, Object> queryCondition);

    NotificationPO selectByIdss(@Param("id") Integer id);

    List<Map<String, Object>> selectPageBySqls(Page page, @Param("params") Map<String, Object> queryCondition);

    List<Map<String, Object>> getDealerNoticeInfo(@Param("page") Page page, @Param("params") Map<String, Object> params);

    List<Map<String, Object>> getCcIsReadList(@Param("page") Page page,@Param("id") Integer id, @Param("appId") String appId, @Param("companyId") Long companyId);

    List<Map<String, Object>> getCcDealerIsReadList(@Param("page") Page page,@Param("id") Integer id, @Param("appId") String appId, @Param("companyId") Long companyId);

    List<Map<String, Object>> getCcDealerNoReadList(@Param("page") Page<Map<String, Object>> page, @Param("id") Integer id, @Param("appId") String appId, @Param("companyId") Long companyId);

    List<String> findNeedNotAllPushUserIds(@Param("notificationId") Integer notificationId);

    List<String> findNeedAllPushUserIds(@Param("appId") String appId);

    List<String> findNeedDealerPushUserIds(@Param("notificationId") Integer notificationId, @Param("companyId") Long companyId);
}
